package com.service.single.example.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @Author: 一休
 * @DateTime: 2024/3/5 16:34
 */
@Slf4j
@Component
public class MyListener {

    @EventListener(MyApplicationEvent.class)
    public void onApplicationEvent(MyApplicationEvent event) {
        String msg = event.getMessage();
        log.info("监听消息：{}", msg);
        log.info("参数: {}", event.getSource());
    }
}
